package com.medicine.config;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

//    注解式交换机与队列的绑定关系
public class AnnotationExchange {


    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = "topic.queue", durable = "true"),
            exchange = @Exchange(value = "topic.exchange", durable = "true", type = "topic"),
            key = {"red", "blue"}
    ))
    public void onMessage(String msg) {
        System.out.println("simple.queue 接收到消息：" + msg);
    }

}
